{extend name="public/base" /}

{block name="content"}
<style>
    .img-responsive [data-ratio="16:9"]{
        height: 7rem;
    }
    .test{
        border-radius: 0%;
        width: 100%;
        padding-bottom: 6%;
        line-height:9vw;
    }
</style>
<!--页面路径 和 页面标题-->
<div class="page-title">

    <div class="title-env">
        <h1 class="title">系统设置</h1>
        <p class="description">{$title}</p>
    </div>

    <div class="breadcrumb-env">

        <ol class="breadcrumb bc-1">
            <li>
                <a href="/admin"><i class="fa-home"></i>Home</a>
            </li>
            <li>
                <a href="">系统设置</a>
            </li>
            <li class="active">
                <strong>{$title}</strong>
            </li>
        </ol>

    </div>

</div>

<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">{$title}</font></font></h3>
            </div>

            <div class="panel-body">
                <form id="edit-form" method="post" class="form-horizontal" action="/admin/system/state?type={$Think.get.type}">
                    <div class="form-group">
                        <div class="col-sm-12">
                            {switch name="Think.get.type"}
                            {case value="video"}
                            <textarea class="form-control ckeditor" rows="10" name="state_video">{$configs}</textarea>
                            {/case}
                            {case value="member"}
                            <textarea class="form-control ckeditor" rows="10" name="state_member">{$configs}</textarea>
                            {/case}
                            {case value="copyright"}
                            <textarea class="form-control ckeditor" rows="10" name="state_copyright">{$configs}</textarea>
                            {/case}
                            {case value="privacy"}
                            <textarea class="form-control ckeditor" rows="10" name="state_privacy">{$configs}</textarea>
                            {/case}
                            {/switch}

                        </div>
                    </div>

                    <div class="form-group">
                        <input type="button" class="btn btn-info btn-single pull-right" id="edit-button" value="Save changes">
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="js"}
<script src="/static/assets/js/ckeditor/ckeditor.js"></script>
<script src="/static/assets/js/ckeditor/adapters/jquery.js"></script>

<script>
    //编辑分类表单提交
    $("#edit-button").click(function(){
        var targetUrl = $("#edit-form").attr("action");
        var data = $("#edit-form").serialize();
        $.ajax({
            type:'post',
            url:targetUrl,
            cache: false,
            data:data,
            dataType:'json',
            success:function(res){
                if(res.code == 0) {
                    error(res.msg)
                    setTimeout("window.location.href='/admin/system/state?type={$Think.get.type}'",1000);
                }else{
                    success(res.msg);
                    setTimeout("window.location.href='/admin/system/state?type={$Think.get.type}'",1000);
                }
            }
        })
    });

</script>
{/block}